<# # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script is designed To Disable Virtual machine platform # Note: We will Enable the 'HypervisorPlatform' and 'VirtualMachinePlatform' Windows optional features individually # Configuration Type - COMPUTER #> $featureNames = @("HypervisorPlatform","VirtualMachinePlatform") foreach($featurename in $featurenames) { $Feature = Get-WindowsOptionalFeature -FeatureName $featureName -Online if($Feature.State -eq "Enabled") { $null = Disable-WindowsOptionalFeature -FeatureName $featurename -NoRestart -Online -WarningAction SilentlyContinue Write-Host "$featurename feature is Enabled successfully" Write-Host "Restart is required" } else { Write-Host "$featurename feature is Enabled already" } }